﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;
namespace DAO
{
    public partial class LoaiNVL_DAO
    {
        /// <summary>
        /// Thêm mới một nhan viên
        /// </summary>
        /// <param name="nhanvien"></param>
        /// <returns></returns>
        public bool ThemLoaiNVL(LoaiNVL loainvl_dto)
        {
            DataProvider dp = new DataProvider();

            SqlParameter[] Parameter = new SqlParameter[2];

            Parameter[0] = new SqlParameter("@MaLoaiNVL", loainvl_dto.MaLoaiNVL);
            Parameter[1] = new SqlParameter("@TenLoaiNVL", loainvl_dto.TenLoaiNVL);
            return dp.ExecutenonQuery("sp_ThemLoaiNVL", Parameter);
        }
        public bool CapNhatLoaiNVL(LoaiNVL loainvl_dto)
        {
            DataProvider dp = new DataProvider();

            SqlParameter[] Parameter = new SqlParameter[2];

            Parameter[0] = new SqlParameter("@MaLoaiNVL", loainvl_dto.MaLoaiNVL);
            Parameter[1] = new SqlParameter("@TenLoaiNVL", loainvl_dto.TenLoaiNVL);
            return dp.ExecutenonQuery("sp_CapNhatLoaiNVL", Parameter);
        }
        public bool XoaLoaiNVL(LoaiNVL loainvl_dto)
        {
            DataProvider dp = new DataProvider();

            SqlParameter[] Parameter = new SqlParameter[1];

            Parameter[0] = new SqlParameter("@MaLoaiNVL", loainvl_dto.MaLoaiNVL);
            return dp.ExecutenonQuery("sp_XoaLoaiNVL", Parameter);
        }
        public DataTable DanhSachLoaiNVL( )
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();

            dt = dp.ExecuteQuery("sp_DanhSachLoaiNVL");
            return dt;
        }
        public string MaLoaiNVLTang()
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();

            dt = dp.ExecuteQuery("sp_MaLoaiNVL_Tang");
            return dt.Rows[0][0].ToString();
        }
        public DataTable DanhSachLoaiNVL_Ma(string strMa)
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();
            SqlParameter[] Parameter = new SqlParameter[1];

            Parameter[0] = new SqlParameter("@MaLoaiNVL", strMa);
            dt = dp.ExecuteQuery("sp_DanhSachLoaiNVL_Ma",Parameter);
            return dt;
        }

    }
}
